<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html class="win-frame">
<head>
<title>${name_china}管理-新建${name_china}</title>
 <%@include file="/common/head.jsp" %>
<style>
.btn-save{
		 background-color: #02d1cf;
  		  color: #fff;
	}
.showWay{
	width:600px;margin-left:auto;margin-right:auto;
}
</style>
</head>
<body class="iframe-page">
<div class="page-title-wrapper">
    <div class="page-title">
        <div class="page-title-text">
            <span>${name_china}管理</span>
            <span class="split"></span>
            <span>新建${name_china}</span>
        </div>
        <a id="goBack" class="btn-return distance-left" href="javascript:;"><i class="icon icon-arrow-left"></i>返回上级</a>
    </div>
    <div class="page-title-border"></div>
</div>

<form id="addForm" method="post">
  <div id="left" class="showWay">
	 <div class="form-wrapper">
		
	     <div class="form-cont">
	        <p class="form-cont-title">店铺名</p>
	        <input type="text" id="storeName" name="storeName" class="summer-input summer-validatebox"/>
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title">小程序码/体验码</p>
	        <input type="hidden" id="qrCode" name="qrCode" class="summer-input summer-validatebox"/> 
	     </div>
	     
	      <div class="form-cont">
	        <p class="form-cont-title">服务类型</p>
	        <input type="text" id="serviceType" name="serviceType" class="summer-input"/> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title">审核状态</p>
	        <input type="text" id="state" name="state" class="summer-input summer-validatebox"/> 
	     </div>
	     
	     <div class="form-cont">
	        <p class="form-cont-title">版本号</p>
	        <input type="text" id="version" name="version" class="summer-input summer-validatebox"/> 
	     </div>
	     
	 <div class="form-btn-wrapper" id="funcbar">
        <a class="btn btn-save" id="add">保存</a>
        <a class="btn btn-normal" id="backBtn">关闭</a>
    </div>
  </div>
  </div>
	
</form>
<script>


//请求url
var CONST_URL = {
	INIT_MAIN: basePath + "${common_url}init",
   	ADD: basePath + "${common_url}add"
};
    var  i=1,
    	 permission = CommonUtil.getPermission('${name_english}');
    $(function () {
     	
    	//
    	//初始化下拉选项
    	 $('#state').combobox({
            valueField : 'code',
            textField : 'name',
            url : COMMON_URL.getCode + '?type=XCX_STATE'
        });
    	$("#qrCode").filePlugin();
    	//保存按钮
    	$('#add').on('click',  submit);
    	
    	//返回按钮
    	$('#backBtn,#goBack').on('click',backMain);
    });
    //表单提交
    function submit(event) {
    	$("#addForm").form({
        	 buttons : ['#saveBtn','#saveBtnContinue'],
             ajax: {
                 url: CONST_URL.ADD
             },
             onSubmitSuccess: function (data) {
            	 console.log(data);
            	 if(data.msg != "null"){
            		 alert(data.msg);
            	 }else{
            		 $.stip({
       	                type:'ok',//显示类型 有info、 ok、 danger
       	                text: '保存成功！',
       	                onBeforeHide: function () {
                      		  backMain();
       	                }
                   	});
            	 }
              }
         }).form("submit");
    }
    
    //保存并继续清空form
    function resetForm(){
        //$('#xm,#zw,#cs,#bgdh,#sjhm').val('');
    }
    
    //返回主页面
    function backMain() {
    	window.location.href = CONST_URL.INIT_MAIN;
    }
    
    
</script>
</body>
</html>